package com.edu.test;

import com.edu.interceptor.MyInterceptor;
import com.edu.service.impl.TeacherServiceImpl;
import com.edu.service.impl.WriterServiceImpl;
import org.springframework.cglib.proxy.Enhancer;

public class CglibTest02 {

    public static void main(String[] args) {
        //1.创建被代理对象
        TeacherServiceImpl ts = new TeacherServiceImpl();
        //2 创建代理对象
        TeacherServiceImpl proxy = (TeacherServiceImpl) Enhancer.create(ts.getClass(),new MyInterceptor(ts));

        proxy.selectTeacher();

        proxy.addTeacher();
    }
}
